<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>求阶乘</title>
	</head>
	<body>
		 <script>
		 	var n=prompt("请输入一个数：");
		 	var a=n;
		 	var sum=1;
		 	while(n>0){
		 		sum=sum*n;
		 		n--;
		 	}
		 	alert(a+"的阶乘="+sum);
		 </script>
	</body>
</html>